package cn.hs.service.impl;/**
 * @author Jovan Hou 2024/10/24
 **/

import cn.hs.entity.Chargetype;
import cn.hs.entity.Fm;
import cn.hs.mapper.ChargetypeMapper;
import cn.hs.service.ChargeTypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @ClassName ChargeTypeServiceImpl
 * @Description TODO
 * @Author CnYuu
 * @Date 2024年10月24日 10:48
 * @Version 1.0
 */
@Service
public class ChargeTypeServiceImpl implements ChargeTypeService
{
    @Autowired
    private ChargetypeMapper chargetypeMapper;
    @Override
    public int insert(Chargetype chargetype)
    {

        return  chargetypeMapper.insert(chargetype);
    }

    @Override
    public int deleteById(Integer id)
    {
        return chargetypeMapper.deleteByPrimaryKey(Long.valueOf(id));
    }

    @Override
    public int update(Chargetype chargetype)
    {
        return chargetypeMapper.updateByPrimaryKey(chargetype);
    }

    @Override
    public PageInfo findAll(Integer pageNum, Integer pageSize, Chargetype chargetype)
    {
        PageHelper.startPage(pageNum, pageSize);
        List<Chargetype> chargetypes = chargetypeMapper.selectAll(chargetype);
        PageInfo pageInfo = new PageInfo(chargetypes);

        return pageInfo;

    }

    @Override
    public PageInfo findbyForignId(Integer pageNum, Integer pageSize, Integer id)
    {
        return null;
    }

    @Override
    public List<Chargetype> selectByconsultid(Long consultid) {
        return chargetypeMapper.selectByconsultid(consultid);
    }
}
